{if $smarty.get.print != 1}
  {include file="header.tpl"}
{else}
  <table width="100%">
    <td width="33.33%"><img src="./images/shreeSava.jpg" /></td>
    <td width="33.33%" align="center"><img src="./images/shreeGanesh.jpg" /></td>
    <td width="33.33%" align="right"><img src="./images/shreeGelMataji.jpg" /></td>
  </table>
{/if}
<script type="text/javascript">
function deleteRow(vepaariBookId)
{
  if(confirm("Warning: Are you sure?\nDeletion is permanent. Continue anyway."))
  {
    location.href = "deleteVepaariBook.php?vepaariBookId="+vepaariBookId;
  }
}
function bookFunction(id)
{
  document.form1.bdate.value="1";
  document.form1.submit();
}
</script>
<form name="form1" action="" method="post">
<input type="hidden" name="bdate" id="bdate" value="0" />

<div class="contentDiv">
  <table border="0" align="center" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="5" class="table1">
      {$l_partySelect} : 
      <select name="party"  onchange="bookFunction()" >
        <option value="0">{$l_partySelect}</option>
        {html_options values=$party.partyId output=$party.partyName selected={$partyId}}
      </select>
    </td>
     <td colspan="5" class="table1">
      {$l_from} :
      {html_select_date prefix="fromDate" start_year="-2" end_year="+1" field_order="DMY" day_value_format="%02d" time={$fromDate}}
      {$l_to}
     {html_select_date prefix="toDate" start_year="-2" end_year="+1" field_order="DMY" day_value_format="%02d" time={$toDate}}
    </td>
    <td class="table1">
      <input type="submit" name="submitBtn" value="{$l_find}" />
    </td>
  </tr>
  <tr>
    <td colspan="6" vAlign="top">
      <table border="0" align="center" width="100%" cellspacing="0" cellpadding="2" class="veeparibook">
      <tr>
        <th colspan="7" class="table1">{$l_credit}</th>
      </tr>
      <tr align="right" class="table1">
        <th>&nbsp;</th>
        <th>{$l_date}</th>
        <th>{$l_particulars}</th>
        <th>{$l_weight}</th>
        <th>{$l_touch}</th>
        <th>{$l_fine}</th>
        <th>{$l_amount}</th>
      </tr>
      <tr align="right" class="table2">
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>Opening</td>
        <td>{if $opening.crWeight != 0}{$opening.crWeight|string_format:"%.0f"}{/if}</td>
        <td>{if $opening.crTouch != 0}{$opening.crTouch|string_format:"%.2f"}{/if}</td>
        <td>{if $opening.crFine != 0}{$opening.crFine|string_format:"%.0f"}{/if}</td>
        <td>{if $opening.crAmount != 0}{$opening.crAmount|string_format:"%.0f"}{/if}</td>
      </tr>
      {section name="sec" loop=$veepariBookCr|@count}
      <tr align="right" class="table2">
        <td NOWRAP>
          {if $smarty.get.print != 1}
            <a href="javascript:deleteRow({$veepariBookCr[sec].vepaaribookId})">{$l_delete}</a>
            <a href="vepaariBook.php?vepaaribookId={$veepariBookCr[sec].vepaaribookId}">{$l_edit}</a>
          {else}
            &nbsp;
          {/if}
        </td>
        <td NOWRAP>{$veepariBookCr[sec].vepaariBookDate|date_format:"%e-%b-%Y"}</td>
        <td style="border-right:1px solid;">{$veepariBookCr[sec].particulars}</td>
        <td style="border-right:1px solid;">{if $veepariBookCr[sec].weight != 0}{$veepariBookCr[sec].weight|string_format:"%.0f"}{else}&nbsp;{/if}</td>
        <td style="border-right:1px solid;">{if $veepariBookCr[sec].touch != 0}{$veepariBookCr[sec].touch|string_format:"%.2f"}{else}&nbsp;{/if}</td>
        <td style="border-right:1px solid;">{if $veepariBookCr[sec].fine != 0}{$veepariBookCr[sec].fine|string_format:"%.0f"}{else}&nbsp;{/if}</td>
        <td>{if $veepariBookCr[sec].amount != 0}{$veepariBookCr[sec].amount|string_format:"%.0f"}{/if}</td>
      </tr>
      {/section}
      <tr>
        <td colspan="8"><hr/></td>
      </tr>
      <tr class="table1">
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="right">{$l_total}</td>
        <td align="right">{$total.weight|string_format:"%.0f"}</td>
        <td align="right">&nbsp;</td>
        <td align="right">{$total.crFine|string_format:"%.0f"}</td>
        <td align="right">{$total.crAmount|string_format:"%.0f"}</td>
      </tr>
      </table>
    </td>
    <td colspan="6" vAlign="top">
      <table border="0" align="center" width="100%" cellspacing="0" cellpadding="2" class="veeparibook">
      <tr>
        <th colspan="5" class="table1">{$l_debit}</th>
      </tr>
      <tr align="right" class="table1">
        <th align="left">|&nbsp;</th>
        <th>{$l_date}</th>
        <th>{$l_particulars}</th>
        <th>{$l_fine}</th>
        <th>{$l_amount}</th>
      </tr>
      <tr align="right" class="table2">
        <td align="left">|&nbsp;</td>
        <td>&nbsp;</td>
        <td>Opening</td>
        <td>{if $opening.drFine != 0}{$opening.drFine|string_format:"%.0f"}{else}&nbsp;{/if}</td>
        <td>{if $opening.drAmount != 0}{$opening.drAmount|string_format:"%.0f"}{else}&nbsp;{/if}</td>
      </tr>
      {section name="sec" loop=$veepariBookDr|@count}
      <tr align="right" class="table2">
        <td align="left" NOWRAP>
          |
          {if $smarty.get.print != 1} 
            {if $veepariBookDr[sec].vepaaribookId != 0}
              <a href="javascript:deleteRow({$veepariBookDr[sec].vepaaribookId})">{$l_delete}</a>
              <a href="vepaariBook.php?vepaaribookId={$veepariBookDr[sec].vepaaribookId}">{$l_edit}</a>
            {else}
              &nbsp;
            {/if}
          {else}
            &nbsp;
          {/if}
        </td>
        <td NOWRAP style="border-right:1px solid;">{$veepariBookDr[sec].vepaariBookDate|date_format:"%e-%b-%Y"}</td>
        <td style="border-right:1px solid;">{$veepariBookDr[sec].particulars}</td>
        <td style="border-right:1px solid;">{if $veepariBookDr[sec].fine != 0}{$veepariBookDr[sec].fine|string_format:"%.0f"}{else}&nbsp;{/if}</td>
        <td>{if $veepariBookDr[sec].amount != 0}{$veepariBookDr[sec].amount|string_format:"%.0f"}{else}&nbsp;{/if}</td>
      </tr>
      {/section}
      <tr>
        <td colspan="5"><hr/></td>
      </tr>
      <tr class="table1">
        <td align="right">&nbsp;</td>
        <td align="right">&nbsp;</td>
        <td align="right">{$l_total}</td>
        <td align="right">{$total.drFine|string_format:"%.0f"}</td>
        <td align="right">{$total.drAmount|string_format:"%.0f"}</td>
      </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td><b>{$l_netFine} : {$total.netFine|string_format:"%.0f"}</b></td>
    <td><b>{$l_netAmount} : {$total.netAmount|string_format:"%.0f"}</b></td>
  </tr>
  </table>
</div>
</form>
{if $smarty.get.print != 1}
  {include file="footer.tpl"}
{/if}
